Tokens for Custom Query and Query Data

The Custom Query and Query Data activities produce the following token.

Name Description Sample Syntax*
Results Found Whether results were found by the query. This token can have one of two values: True or False. %(CustomQuery_Results Found)
Result Count The number of results found with the Custom Query or Query Data activity. %(CustomQuery_Result Count)

*The "CustomQuery" portion of the syntax changes to match the activity's name as specified in the Activity Name property box. Note that all non-alphanumeric characters, except underscores, are removed from the name. For example, if you rename the activity Query "Database A_1", the syntax for the Results Found token will be %(QueryDatabaseA_1_Results Found).

The first row of the queried table are available as tokens

When a query is run, a token is created for each column in the table returned. Each token contains its column's value in the first row returned by the query. If you want to access tokens for additional rows, use a For Each Row activity.

To use first row tokens in the Workflow Designer, you must first test this query. Learn more about testing queries.

Name Description Sample Syntax*
Column Name A token is created for each column of the first row of the database table. The token name is the same as the column name. The token's value is the value in the Column Name column of the current row. %(CustomQuery_Column Name)

*The "Column Name" portion of the syntax changes to match the column name in the first row of the specified table. Note that all non-alphanumeric characters, except underscores, are removed from the name. For example, if you rename the activity Process [Rows], the syntax for the column named "Addresses" token will be %(ProcessRows_Addresses).

Column tokens available with the For Each Row activity

The Custom Query and Query Data activities also produce one token per column in the database table, which are available to activities inside the For Each Row activity. With the Custom Query activity you must use a SELECT query and test the query first to access these tokens. The For Each Row activity runs one time per row in the column. Each time it runs, the token value reflects the information relevant to the row it is currently processing.

Name Description Sample Syntax*
Column Name A token is created for each column in the database table. The token name is the same as the column name. The token's value is the value in the Column Name column of the current row. %(ForEachRow_Column Name)

*The "ForEachRow" portion of the syntax changes to match the activity's name as specified in the Activity Name property box. Note that all non-alphanumeric characters, except underscores, are removed from the name. For example, if you rename the activity Process [Rows], the syntax for the column named "Addresses" token will be %(ProcessRows_Addresses).